# -*- coding:utf-8 -*-


import json
from flask import Flask
from flask import make_response
import config as config

app = config.app

@app.route('/businesscenter')
def r_index():
    sql = config.db
    ret = sql.execute("select * from constant")

    info = sql.fetchmany(ret)
    for li in info:
        print(li)

    return 'Hello Business Center'


@app.route('/businesscenter/constant')
def r_constant():
    sql = config.db
    ret = sql.execute("select * from constant")

    info = sql.fetchall()
    jret = json.dumps(info, ensure_ascii=False)

    response = make_response(jret)
    response.headers['Access-Control-Allow-Origin'] = '*'
    # response.headers['Access-Control-Allow-Methods'] = 'POST'
    # response.headers['Access-Control-Allow-Headers'] = 'x-requested-with,content-type'
    return response
